﻿using DataControll;
using huqiang;
using huqiang.Communication;
using huqiang.UIModel;
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;

namespace DataHandle
{
    [Serializable]
    public class LogData
    {
        public string condition;
        public string stackTrace;
        public LogType type;
        public string addr;
    }
    public class LogHandle
    {
        public static void Handle(KcpLink link, string json)
        {
            if (json != null)
            {
                var dat = JsonUtility.FromJson<LogData>(json);
                if(dat!=null)
                {
                    dat.addr = link.endPoint.Address + ":" + link.port;
                    KcpDataControll.Instance.AddMainMission((o) => {
                        UIPage.CurrentPage.Cmd(MsgCmd.Log, o);
                    }, dat);
                }
            }
        }
    }
}
